<template>
  <div ref="myDiv" class="main" />
</template>

<script>
import * as echarts from 'echarts/core'
// 引入柱状图图表，图表后缀都为 Chart
import { RadarChart } from 'echarts/charts'
// 引入提示框，标题，组件后缀都为 Component
import {
  TitleComponent,
  TooltipComponent
} from 'echarts/components'
// 引入 Canvas 渲染器，注意引入 CanvasRenderer 或者 SVGRenderer 是必须的一步
import { CanvasRenderer } from 'echarts/renderers'
// 注册必须的组件
echarts.use([
  TitleComponent,
  TooltipComponent,
  RadarChart,
  CanvasRenderer
])
export default {
  mounted() {
    const myChart = echarts.init(this.$refs.myDiv)
    myChart.setOption({
      title: {
        text: '员工雷达图'
      },
      tooltip: {
        trigger: 'item'
      },
      radar: {
        indicator: [
          { name: '工作效率', max: 100 },
          { name: '考勤', max: 100 },
          { name: '积极性', max: 100 },
          { name: 'bug', max: 100 },
          { name: '分享', max: 100 },
          { name: '技术', max: 100 }
        ]
      },
      series: [
        {
          type: 'radar',
          data: [
            {
              value: [72, 50, 62, 75, 65, 80],
              name: '张三'
            },
            {
              value: [60, 66, 68, 76, 62, 67],
              name: '李四'
            }
          ]
        }
      ]
    })
  }
}
</script>

<style>
.main {
  width: 100%;
  height: 600px;
}
</style>
